home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 September / macformat-004.iso / Shareware City / Developers / Mac F2C 1.0 / Mac F2C READ ME < prev    next >
Encoding:
Text File  |  1994-06-11  |  19.2 KB  |  450 lines  |  [TEXT/ttxt]

  1.  
  2. Mac F2C  --  A FORTRAN-to-C compiler for the Macintosh
  3. ******************************************************
  4.  
  5. F2C core ©1989-1994 AT&T Bell Laboratories and Bellcore
  6. Macintosh Interface ©1994 Igor Mikolic-Torreira
  7.  
  8. This software is freeware:  it may be used and copied freely so long as 
  9. the copyright notices and associated documentation remain attached.
  10.  
  11.  
  12.  
  13. CONTENTS
  14. ********
  15.  
  16.     A.  Mac F2C REQUIREMENTS
  17.     
  18.     B.  WHAT IS INCLUDED
  19.     
  20.     C.  IF YOU ARE NOT USING THINK C VERSION 7
  21.     
  22.     D.  INSTALLING Mac F2C
  23.     
  24.     E.  BRINGING THE LIBRARIES UP-TO-DATE
  25.  
  26.     F.  VERIFYING CORRECT OPERATION OF Mac F2C
  27.  
  28.     G.  TRANSLATING FORTRAN PROGRAMS
  29.     
  30.     H.  USING C CODE PRODUCED BY MAC F2C
  31.     
  32.     I.  KNOWN PROBLEMS
  33.     
  34.     J.  COMPATIBILITY WITH UNIX F2C
  35.     
  36.     K.  BUG REPORTS AND OTHER COMMENTS
  37.  
  38.     L.  LICENSE AND OTHER ANNOYING LEGAL STUFF
  39.  
  40.  
  41.  
  42. A.  Mac F2C REQUIREMENTS
  43. ************************
  44.  
  45. (1) A 68020 or better
  46.  
  47. (2) System 7.0 or better
  48.  
  49. (3) At least 1 MB of available RAM (2 MB is preferred)
  50.  
  51.  
  52.  
  53. B.  WHAT IS INCLUDED
  54. ********************
  55.  
  56. The Mac F2C distribution set contains the following items:
  57.  
  58. (1) "READ ME" -- A copy of this Read Me message.
  59.  
  60. (2) "Mac F2C" -- the Fortran-to-C compiler.
  61.  
  62. (3) "Mac F2C Libraries" -- a folder containing the libraries required to 
  63.     support programs translated by F2C.  libF77 provides the floating-
  64.     point support; libI77a and libI77b provide the integer and I/O support.  
  65.     These libraries need to be placed where THINK C can find them and 
  66.     brought up-to-date.  See the sections below on installing Mac F2C and 
  67.     on bringing libraries up-to-date.
  68.     
  69. (4) "For 'Standard Libraries'" -- a folder containing versions of the ANSI 
  70.     and unix libraries distributed with THINK C modified to work with Mac 
  71.     F2C output.  These libraries should be placed in the "Standard Libraries" 
  72.     folder located in the folder that contains the THINK Project Manager; 
  73.     see the section on installing Mac F2C.  These libraries also need to be 
  74.     brought up-to-date; see the section below on bringing libraries 
  75.     up-to-date.
  76.     
  77. (5) "For '(Project Models)'" -- a folder containing a model Mac F2C 
  78.     project.  If you have THINK C v7.0 or better, the contents of this 
  79.     folder should be placed in the "(Project Models)" folder located in 
  80.     the folder that contains the THINK Project Manager; see the section 
  81.     on installing Mac F2C.  See the section below on using C code produced 
  82.     by Mac F2C for information on how to use the model Mac F2C project.
  83.  
  84. (6) "AT&T Report 149.ps" -- a postscript file containing AT&T Computing 
  85.     Science Technical Report No. 149.  This report provides very detailed 
  86.     documentation on F2C, the UNIX program on which is the core of 
  87.     Mac F2C.  Consider it your compiler and language reference manual.  
  88.     All users should printout and read this report.
  89.     
  90. (7) "Test Project ƒ" --  a folder containing a test FORTRAN program and 
  91.     the C output produced by Mac F2C.  It also contains a complete project 
  92.     to compile and run that program.  See the section below on verifying 
  93.     correct operation.
  94.     
  95. (8) "For non THINK v7 users" -- a text file containing additional 
  96.     instructions for users who are using earlier versions of THINK C or 
  97.     other compilers.  All the project files included in this distribution 
  98.     have been made using THINK C version 7.0.2.  This file provides guidance 
  99.     on how to create equivalent project files using earlier versions of 
  100.     THINK C.  It also includes guidance for users who are not using 
  101.     Symantec's THINK C compiler (e.g., users of CodeWarrior or MPW).
  102.  
  103.  
  104.  
  105. C.  IF YOU ARE NOT USING THINK C VERSION 7
  106. ******************************************
  107.  
  108. If you have an older version of THINK C, you cannot use the project files 
  109. I have shipped.  You must build your own versions from scratch.  I have 
  110. included additional instructions in the separate file "For non THINK v7 
  111. users".  This also includes some general guidance for users of other 
  112. compilers (e.g., CodeWarrior or MPW), but because I do not own either of 
  113. these, I can only provide general guidance.
  114.  
  115. If you are a THINK version 6 user, let me point out that there is a FREE 
  116. updater from Symantec that will update your project manager, debugger, and 
  117. compilers to version 7.0 (there is also a free 7.0 --> 7.0.2 updater).  
  118. This updater does _not_ include the Universal Headers, Visual Architect, or 
  119. TCL 2.0.  The updater can be found in most Macintosh-oriented archive 
  120. sites.
  121.  
  122.  
  123.  
  124. D.  INSTALLING Mac F2C
  125. **********************
  126.  
  127. For easiest and smoothest operation, the support libraries should be 
  128. installed where the THINK C compiler can find them easily.  If you are 
  129. using THINK version 7, the model project also needs to go in particular 
  130. location.  I recommend you install Mac F2C as follows:
  131.  
  132. (1) The folder "For 'Standard Libraries'" contains two THINK project 
  133.     files: "ANSI F2C" and "unix F2C".  Drag both of these files -- not 
  134.     the folder itself -- to the "Standard Libraries" folder located in 
  135.     the same folder as the THINK Project Manager application.  
  136.  
  137. (2) Drag the _entire_ folder "Mac F2C Libraries" to the folder that 
  138.     contains the THINK Project Manager application.
  139.  
  140. (3) The folder "For '(Project Models)'" contains a model project folder 
  141.     called "Mac F2C Project".  If you are using THINK version 7 or better, 
  142.     drag the folder "Mac F2C Project" to the "(Project Models)" folder 
  143.     located in the same folder as the THINK Project Manager application.  If 
  144.     you do not have THINK version 7 or better, see the section below on using 
  145.     C code produced by Mac F2C for information on how to use the model 
  146.     Mac F2C project. 
  147.  
  148.  
  149.  
  150. E.  BRINGING THE LIBRARIES UP-TO-DATE
  151. *************************************
  152.  
  153. If you are using THINK C version 7.0 or better, the libraries are easily 
  154. brought up to date using the following steps.  If you are using an 
  155. earlier version of THINK C or another compiler, please refer to the 
  156. special instructions in the file "For non THINK v7 users".
  157.  
  158. To bring the Mac F2C libraries up-to-date follow this algorithm:
  159.  
  160. FOR the project files:
  161.  
  162.         (1) "ANSI F2C" in the "Standard Libraries" folder
  163.         (2) "unix F2C" in the "Standard Libraries" folder
  164.         (3) "libI77a"  in the "Mac F2C Libraries" folder
  165.         (4) "libI77b"  in the "Mac F2C Libraries" folder
  166.         (5) "libF77"   in the "Mac F2C Libraries" folder
  167.         
  168. REPEAT the following steps:
  169.  
  170.     (a) Double-click on the project file.  
  171.     
  172.     (b) In the THINK Project Manager's "Source" menu, select the 
  173.         "Make" command.  
  174.         
  175.     (c) Uncheck the "Quick Scan" check-box.  
  176.     
  177.     (d) Click on the "Use Disk" button.  
  178.     
  179.     (e) Click on the "Make" button.
  180.  
  181. END REPEAT
  182.  
  183.  
  184.  
  185. F.  VERIFYING CORRECT OPERATION OF Mac F2C
  186. ******************************************
  187.  
  188. The folder "Test Project ƒ" contains the following files:
  189.  
  190. (1) "test.f" -- a sample FORTRAN program.
  191.  
  192. (2) "test.c (sample)" -- what you should get when you translate 
  193.     the sample FORTRAN code files.
  194.     
  195. (3) "main.c" -- the main program required to run programs produced
  196.     by with Mac F2C.
  197.     
  198. (4) "f2c.h" -- an include file required to compile programs produced by 
  199.     Mac F2C.
  200.  
  201. (5) "Test.π" -- a THINK C v 7.0 project to run the sample program.  
  202.     This will serve as a model for how to compile, link, and run programs 
  203.     translated by F2C.  Note that code produced by F2C must be compiled 
  204.     with 4-byte integers, 8-byte doubles, native floating-point format, far 
  205.     code, and far data.
  206.     
  207. (6) "Test.π Contents"  -  a text file describing the contents of Test.π
  208.  
  209. Translate the sample FORTRAN program "Test.f" simply by dragging it onto 
  210. Mac F2C.  Do not change any of the options (use "Factory Defaults").  Once 
  211. you have done this you can compare it with "Test.c (sample)" file to verify 
  212. that you got the same thing.  If so, double click on the THINK project 
  213. "test.π" and follow the same steps outlined in the "Bringing Libraries 
  214. Up-To-Date" section to bring the test project up-to-date. Run it to 
  215. verify correct operation.
  216.  
  217.  
  218.  
  219. G.  TRANSLATING FORTRAN PROGRAMS
  220. ********************************
  221.  
  222. You can use Mac F2C to translate FORTRAN to C using three methods:
  223.  
  224. (a) Start up Mac F2C and select the corresponding command in the File menu.  
  225.     
  226. (b) Drag-&-Drop a bunch of FORTRAN files onto Mac F2C.
  227.  
  228. (c) Use a scripting language (e.g., AppleScript) to send Mac F2C either an 
  229.     open command or a translate command.
  230.  
  231. FORTRAN files must be TEXT files and *must* end in ".f" or ".F" (sorry, but 
  232. the ending is determined by the unix F2C kernel -- it rejects files handed 
  233. to it with any other endings).
  234.  
  235. The Options menu lets you control the various translation and code 
  236. generation options.  You can also set the creator type for the output 
  237. files.  If you check the "Make these the new defaults" box before clicking 
  238. the "OK" button, your option selections will be saved in a Preference file 
  239. and used again the next time you start Mac F2C.
  240.  
  241. If you do not understand what an option means, check the balloon help.  The 
  242. help balloons provide more detailed explanations of what each option means.  
  243. They also explain why dimmed options are not available and what you can do 
  244. to make them available.
  245.  
  246.  
  247.  
  248. H.  USING C CODE PRODUCED BY MAC F2C
  249. ************************************
  250.  
  251. The C code produced by Mac F2C has the following compile and link requirements:
  252.  
  253.     -   the header file "f2c.h"
  254.     -   the libraries libI77a, libI77b, libF77, ANSI F2C, and unix F2C
  255.     -   4-byte integers
  256.     -   8-byte doubles
  257.     -   native floating-point format
  258.     -   far code
  259.     -   far data
  260.     
  261. In addition, if you compile a stand-alone FORTRAN program (vice only some 
  262. FORTRAN subroutines) you must include "main.c" in your project.  This is 
  263. because the original main routine in the FORTRAN program becomes a function 
  264. that is called by main.c.  In addition, main.c performs a series of 
  265. initializations (primarily related to error catching) prior to executing 
  266. the main FORTRAN program.
  267.  
  268. The model project provided ("Mac F2C Project") is a folder that contains 
  269. everything you need to compile and run code produced by Mac F2C.  This 
  270. folder has a copy of main.c, f2c.h, and a project file that includes the 
  271. appropriate libraries and option settings.
  272.  
  273. If you have THINK C version 7.0 or better, simply create a new project by 
  274. using the "New" command in the THINK Project Manager's "File" menu and 
  275. selecting "Mac F2C Project" as the model for the new project.  Add your 
  276. code files as appropriate, bring it up-to-date (you may need to use the 
  277. "Make" command and the "Use Disk" option the first time), and run.  
  278.  
  279. If you have an earlier version of THINK C, first replace the project file 
  280. provided in "Mac F2C Project" with one made with your version of THINK (I 
  281. have included a list of the project contents for your convenience -- see 
  282. the additional instructions in the file "For non THINK v7 users" if you 
  283. have trouble doing this).  Do not include any objects at this time.  To 
  284. start a new project, duplicate the entire "Mac F2C Project" folder, change 
  285. the names of files and folders as appropriate, add your code files, and 
  286. bring everything up-to-date.
  287.  
  288. If you compile a FORTRAN subroutine or function that you want to call from 
  289. a C program, look at the output C code to see the appropriate calling 
  290. protocol.  You may or may not need to include the F2C support libraries 
  291. (libF77, libI77a, and libI77b).  In rare cases, you may also need to copy 
  292. some of the initialization code from "main.c" to your calling program.
  293.  
  294. As noted above, code produced by Mac F2C *MUST* be compiled with 4-byte 
  295. integers.  This requirement cannot be relaxed.  The other requirements 
  296. (8-byte doubles, native floating-point format, far data, and far code) can 
  297. sometimes be relaxed:
  298.  
  299.     -   IF you do not use doubles in any situation where their size 
  300.         relative to reals matters (e.g., if you do not use doubles in 
  301.         equivalence and common statements), then your code probably does
  302.         not require 8-byte doubles.  You need to verify this on a case-
  303.         by-case basis.
  304.         
  305.         This requirement exists because Mac F2C follows FORTRAN sizing 
  306.         rules when compiling FORTRAN code: sizeof(real) == sizeof(integer) 
  307.         and sizeof(double) == 2*sizeof(real).  FORTRAN real is compiled as 
  308.         C float and FORTRAN double as C double, so doubles have to be 
  309.         8-bytes long for equivalence and common statements to be properly 
  310.         aligned.  There are a few other cases where the size of double 
  311.         variables matters; see AT&T Computing Science Technical Report 
  312.         No. 149 (included with Mac F2C) for a detailed discussion.
  313.         
  314.     -   IF you compile your program with the option "Local variables are 
  315.         automatic" and you do not have large static data structures, you 
  316.         *might* not need "Far Data".  You need to verify this on a case-
  317.         by-case basis.
  318.         
  319.         Mac F2C creates large static data structures for I/O.  If you create 
  320.         local variables in the global area (static vice automatic) or if you 
  321.         have other static data, you will almost certainly require "Far Data".  
  322.         The I/O data structures can be large enough that you may require "Far 
  323.         Data" for that reason alone.  
  324.         
  325.     -   IF your program is not very large and doesn't have a large number of 
  326.         subroutines, you probably will not need "Far Code".  You need to verify 
  327.         this on a case-by-case basis.
  328.         
  329.         Mac F2C tends to produced redundant copies of utility code (especially 
  330.         code for performing array indexing).  It can also produce large numbers 
  331.         of auxiliary functions.  The result is that "Far Code" is often 
  332.         required.  Compile first with "Far Code", then check the code size and 
  333.         jump table to see if you can relax this requirement.
  334.         
  335.     -   IF your program will NOT be compiled under Symantec C++ (i.e., you 
  336.         chose K&R C or ANSI C output vice C++ output), you do not need native 
  337.         floating-point format.  The native floating-point format option is 
  338.         selected only to guarantee compatibility with the Symantec C++ compiler 
  339.         should you chose to produce C++ code from the FORTRAN code.
  340.         
  341. If you change the "8-byte doubles", "native floating-point format", "Far 
  342. Code", or "Far Data" options, remember to also change them in all the 
  343. libraries, specifically "libI77a", "libI77b", "libF77", "ANSI F2C", and 
  344. "unix F2C".
  345.  
  346. I urge all users to read the enclosed AT&T Computing Science Technical 
  347. Report No. 149.  Consider it your compiler and language reference 
  348. manual.  You can print the report by downloading it to any PostScript 
  349. printer.  You can use Apple's LaserWriter Utility application to do 
  350. this or you can use any of the many equivalent utilities.
  351.  
  352.  
  353.  
  354. I.  KNOWN PROBLEMS
  355. ******************
  356.  
  357. There are a series of problems in Mac F2C that arise because the original 
  358. UNIX version of F2C (a stand-alone program) is incorporated as a 
  359. subroutine.  The original UNIX F2C is designed to compile one file and 
  360. quit, so lots of bugs such as memory leaks and dangling open files don't 
  361. show up -- all memory is released and files are automatically closed when 
  362. the program quits.  In Mac F2C, the original F2C program has been turned 
  363. into a subroutine which can be called several times -- and each time the 
  364. leaked memory is lost to future iterations.  I have fixed the dangling open 
  365. file bugs in F2C, but not the memory leaks.  This means that you can easily 
  366. run out of memory if you translate more than about a dozen FORTRAN files at 
  367. a shot (fewer if they are big or complicated).  The work-around is to 
  368. translate a few files at a time, quit and re-start Mac F2C, and then do a 
  369. few more.  You can also give Mac F2C a bigger memory allocation.
  370.  
  371. I know this is less than satisfactory, but the memory leaks are too hard to 
  372. fix.  Sorry, but I had a bad enough time tracking down all the files that 
  373. the original UNIX F2C left open.  It was even harder to figure out how to 
  374. close them without completely re-writing large portions of unix F2C!
  375.  
  376.  
  377.  
  378. J.  COMPATIBILITY WITH UNIX F2C
  379. *******************************
  380.  
  381. This version of Mac F2C is based on the unix version as of 4 April 1994.  
  382. The unix version is maintained and updated on a semi- regular basis.  I 
  383. plan to update Mac F2C about once a year to incorporate all changes that 
  384. have been made to the unix version during the past year.  I may release 
  385. interim versions at shorter intervals as required to fix significant bugs.
  386.  
  387.  
  388.  
  389. K.  BUG REPORTS AND OTHER COMMENTS
  390. **********************************
  391.  
  392. My name is Igor Mikolic-Torreira and I can be reached at 
  393. igormt@alumni.caltech.edu.  
  394.  
  395. If you find Mac F2C useful, please drop me a note.  If you really think it 
  396. is the most useful thing in the whole world and worth its weight in gold, 
  397. please donate that amount of gold to your favorite charity ;)
  398.  
  399. If you find any bugs or would like to request a particular feature, let me 
  400. know.  I will try to fix interface bugs or at least provide work-arounds 
  401. promptly.  I will forward compiler bugs to AT&T.  If you believe you have a 
  402. code generation bug, _please_ send me a sample of the FORTRAN code that 
  403. produces the problem.
  404.  
  405.  
  406.  
  407. L.  LICENSE AND OTHER ANNOYING LEGAL STUFF
  408. ******************************************
  409.  
  410. The compiler engine of Mac F2C is based on the unix version of F2C and is
  411. Copyright 1990, 1993, 1994 by AT&T Bell Laboratories and Bellcore.
  412.  
  413. Permission to use, copy, modify, and distribute this software and its 
  414. documentation for any purpose and without fee is hereby granted, provided 
  415. that the above copyright notice appear in all copies and that both that the 
  416. copyright notice and this permission notice and warranty disclaimer appear 
  417. in supporting documentation, and that the names of AT&T Bell Laboratories 
  418. or Bellcore or any of their entities not be used in advertising or 
  419. publicity pertaining to distribution of the software without specific, 
  420. written prior permission.
  421.  
  422. AT&T and Bellcore disclaim all warranties with regard to this software, 
  423. including all implied warranties of merchantability and fitness.  In no 
  424. event shall AT&T or Bellcore be liable for any special, indirect or 
  425. consequential damages or any damages whatsoever resulting from loss of use, 
  426. data or profits, whether in an action of contract, negligence or other 
  427. tortious action, arising out of or in connection with the use or 
  428. performance of this software.
  429.  
  430.  
  431. The Macintosh interface portion of Mac F2C was written and is
  432. Copyright 1994 by Igor Mikolic-Torreira.
  433.  
  434. Permission to use, copy, modify, and distribute this software and its 
  435. documentation for any purpose and without fee is hereby granted, provided 
  436. that the above copyright notice appear in all copies and that both that the 
  437. copyright notice and this permission notice and warranty disclaimer appear 
  438. in supporting documentation, and that the name of Igor Mikolic-Torreira 
  439. not be used in advertising or publicity pertaining to distribution of the 
  440. software without specific, written prior permission.
  441.  
  442. Igor Mikolic-Torreira disclaims all warranties with regard to this 
  443. software, including all implied warranties of merchantability and fitness.  
  444. In no event shall Igor Mikolic-Torreira be liable for any special, indirect 
  445. or consequential damages or any damages whatsoever resulting from loss of 
  446. use, data or profits, whether in an action of contract, negligence or other 
  447. tortious action, arising out of or in connection with the use or 
  448. performance of this software.
  449.  
  450.